{% extends "base.html" %}

{% block title %}添加消费记录{% endblock %}

{% block content %}
<h2 class="mb-3 form-container">添加消费记录</h2>
<form id="expenseForm" action="/add" method="post">
    <div class="mb-3 form-container">
        <label for="description" class="form-label">消费内容:</label>
        <input type="text" name="description" class="form-control" required>
    </div>

    <div class="mb-3 form-container">
        <label for="amount" class="form-label">金额:</label>
        <input type="number" step="0.01" name="amount" class="form-control" required>
    </div>

    <div class="mb-3 form-container">
        <label for="payment_method" class="form-label">支付方式:</label>
        <input type="text" name="payment_method" class="form-control" required>
    </div>

    <div class="mb-3 form-container">
        <label for="category" class="form-label">类别:</label>
        <div class="input-group">
            <select name="category" class="form-select" required>
                {% for category in current_user.categories %}
                <option value="{{ category.id }}">{{ category.name }}</option>
                {% endfor %}
            </select>
            <a href="{{ url_for('manage_categories') }}" class="btn btn-outline-primary">管理分类</a>
        </div>
    </div>
    <div class="mb-3 form-container">
        <label for="date" class="form-label">消费日期:</label>
        <input type="date" name="date" class="form-control" required>
    </div>
    <div class="form-container">
        <button type="submit" class="btn btn-success">添加记录</button>
    </div>
</form>
{% endblock %}
